<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="AddItems.aspx.vb" Inherits="GTSWeb_Shipment_AddItems" title="GTS Frieght Management System"  MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    
        <table width="100%">
            <tr>
                <td style="width: 50%" valign="top">
        <h3>Shipment Details</h3>
        <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="ReferenceNumber"
            DataSourceID="ShipmentSource" ForeColor="#333333" Height="114px" Width="440px">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
             <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <ItemTemplate>
                <table style="width: 101%">
                    <tr>
                        <td rowspan="3" style="width: 161px" valign="top">
                            <strong>ShipmentDate:<br />
                            </strong>
                            <asp:Label ID="ShipmentDateLabel" runat="server" Text='<%# Bind("ShipmentDate", "{0:d}") %>'
                                Width="156px"></asp:Label><br />
                            <strong>Shipment Number:</strong>
                            <br />
                            <asp:Label ID="ShipmentNumberLabel" runat="server" Text='<%# Bind("ShipmentNumber") %>'></asp:Label></td>
                        <td rowspan="3" style="width: 116px" valign="top">
                            <strong>Description:<br />
                            </strong>
                            <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Bind("Description") %>'
                                Width="156px"></asp:Label><br />
                            <strong>
                            
                                           Item Count:<br />
                            </strong>
                <asp:Label ID="NrOfPiecesTextBox" runat="server" Text='<%# Bind("NrOfPieces") %>'>
                </asp:Label><br />
                            <strong>
                 Weight:<br />
                            </strong>
                <asp:Label ID="WeightTextBox" runat="server" Text='<%# Bind("Weight") %>'>
                </asp:Label>
                            </td>
                            
                            
                   
                </table>
            </ItemTemplate>
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        </asp:FormView>
                    <br />
                </td>
                <td style="width: 416px" valign="top">
        <H3>Add Items</H3><table>
            <tr>
                <td style="width: 100px; height: 22px; text-align: right">
                    Description</td>
                <td style="width: 317px; height: 22px">
                    <asp:TextBox ID="txtDescription" runat="server" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: right" >
                    Weight</td>
                <td style="width: 317px">
                    <asp:TextBox ID="txtWeight" runat="server"></asp:TextBox>
                    (in pounds)
                </td>
            </tr>
            <tr><TD style="WIDTH: 100px; TEXT-ALIGN: right">Length</TD><TD style="WIDTH: 317px"><asp:TextBox id="txtLength" runat="server"></asp:TextBox> (inches) </TD></tr>
            <tr>
                <td style="width: 100px; text-align: right">Height</td>
                <td style="width: 317px">
                    <asp:TextBox ID="txtHeight" runat="server"></asp:TextBox>
                    (inches)
                </td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: right">
                    Width</td>
                <td style="width: 317px"><asp:TextBox id="txtWidth" runat="server"></asp:TextBox> (inches) </td>
            </tr>
            <tr><TD style="WIDTH: 100px; HEIGHT: 22px"></TD><TD style="WIDTH: 317px; HEIGHT: 22px; TEXT-ALIGN: right"><asp:LinkButton id="lnkAddItem" runat="server" BackColor="#E0E0E0" Width="64px" BorderColor="White">Add Item</asp:LinkButton> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </TD></tr>
            <tr>
                <td colspan="2" style="text-align: left"><asp:Label id="lblMessage" runat="server"></asp:Label></td>
            </tr>
        </table>
        </td>
       
            </tr>
        </table>
    <p>
        </p>
        <h3>Current Shipment</h3>
    <p>
        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
            CellPadding="4" DataKeyNames="ShipmentItemID" DataSourceID="ItemsSource" ForeColor="#333333"
            GridLines="None" Width="100%" AllowPaging="True" PageSize="5">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:TemplateField HeaderText="Description" SortExpression="Description">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Description") %>' Width="100px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Weight" SortExpression="Weight">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Weight") %>' Width="100px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Weight") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Length" SortExpression="Length">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Length") %>' Width="100px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("Length") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Height" SortExpression="Height">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Height") %>' Width="100px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("Height") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Width" SortExpression="Width">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Width") %>' Width="100px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("Width") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Shipment" SortExpression="ReferenceNumber">
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ShipmentsSource"
                            DataTextField="Description" DataValueField="ReferenceNumber" SelectedValue='<%# Bind("ReferenceNumber") %>'>
                        </asp:DropDownList><asp:ObjectDataSource ID="ShipmentsSource" runat="server" InsertMethod="CreateShipment"
                            OldValuesParameterFormatString="{0}" SelectMethod="getAllActiveShipments"
                            TypeName="GTSSystem.BLL.Shipment" UpdateMethod="getAllActiveShipments">
                            <UpdateParameters>
                                <asp:Parameter Name="BranchID" Type="Int32" />
                            </UpdateParameters>
                            <SelectParameters>
                                <asp:ProfileParameter Name="BranchID" PropertyName="BranchId" Type="Int32" />
                            </SelectParameters>
                            <InsertParameters>
                                <asp:Parameter Name="Shipmentdate" Type="DateTime" />
                                <asp:Parameter Name="ClientId" Type="Int32" />
                                <asp:Parameter Name="ClientBranchid" Type="Int32" />
                                <asp:Parameter Name="CarrierId" Type="Int32" />
                                <asp:Parameter Name="Weight" Type="Double" />
                                <asp:Parameter Name="Origin" Type="Int32" />
                                <asp:Parameter Name="OriginAddress" Type="String" />
                                <asp:Parameter Name="OriginPostalCode" Type="String" />
                                <asp:Parameter Name="Destination" Type="Int32" />
                                <asp:Parameter Name="DestinationAddress" Type="String" />
                                <asp:Parameter Name="DestinationPostalCode" Type="String" />
                                <asp:Parameter Name="ServicetTypeId" Type="Int32" />
                                <asp:Parameter Name="Description" Type="String" />
                                <asp:Parameter Name="GST" Type="Double" />
                                <asp:Parameter Name="PST" Type="Double" />
                                <asp:Parameter Name="HST" Type="Double" />
                                <asp:Parameter Name="Surcharge" Type="Double" />
                                <asp:Parameter Name="TotalPieces" Type="Int32" />
                                <asp:Parameter Name="UserName" Type="String" />
                                <asp:Parameter Name="StatusId" Type="Int32" />
                                <asp:Parameter Name="ShipmentNumber" Type="Int32" />
                            </InsertParameters>
                        </asp:ObjectDataSource>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ShipmentsSource"
                            DataTextField="Description" DataValueField="ReferenceNumber" Enabled="False"
                            SelectedValue='<%# Bind("ReferenceNumber") %>'>
                        </asp:DropDownList><asp:ObjectDataSource ID="ShipmentsSource" runat="server" InsertMethod="CreateShipment"
                            OldValuesParameterFormatString="{0}" SelectMethod="getAllActiveShipments"
                            TypeName="GTSSystem.BLL.Shipment" UpdateMethod="getAllActiveShipments">
                            <UpdateParameters>
                                <asp:Parameter Name="BranchID" Type="Int32" />
                            </UpdateParameters>
                            <SelectParameters>
                                <asp:ProfileParameter Name="BranchID" PropertyName="BranchId" Type="Int32" />
                            </SelectParameters>
                            <InsertParameters>
                                <asp:Parameter Name="Shipmentdate" Type="DateTime" />
                                <asp:Parameter Name="ClientId" Type="Int32" />
                                <asp:Parameter Name="ClientBranchid" Type="Int32" />
                                <asp:Parameter Name="CarrierId" Type="Int32" />
                                <asp:Parameter Name="Weight" Type="Double" />
                                <asp:Parameter Name="Origin" Type="Int32" />
                                <asp:Parameter Name="OriginAddress" Type="String" />
                                <asp:Parameter Name="OriginPostalCode" Type="String" />
                                <asp:Parameter Name="Destination" Type="Int32" />
                                <asp:Parameter Name="DestinationAddress" Type="String" />
                                <asp:Parameter Name="DestinationPostalCode" Type="String" />
                                <asp:Parameter Name="ServicetTypeId" Type="Int32" />
                                <asp:Parameter Name="Description" Type="String" />
                                <asp:Parameter Name="GST" Type="Double" />
                                <asp:Parameter Name="PST" Type="Double" />
                                <asp:Parameter Name="HST" Type="Double" />
                                <asp:Parameter Name="Surcharge" Type="Double" />
                                <asp:Parameter Name="TotalPieces" Type="Int32" />
                                <asp:Parameter Name="UserName" Type="String" />
                                <asp:Parameter Name="StatusId" Type="Int32" />
                                <asp:Parameter Name="ShipmentNumber" Type="Int32" />
                            </InsertParameters>
                        </asp:ObjectDataSource>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
            <EditRowStyle BackColor="#999999" Width="100px" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <EmptyDataTemplate>
                Shipment is currently empty.
            </EmptyDataTemplate>
        </asp:GridView>
    </p>
    <p>
        <asp:Label ID="lblError" runat="server" Font-Size="Smaller"></asp:Label>
        <asp:ObjectDataSource ID="ItemsSource" runat="server" DeleteMethod="deleteShipmentItem"
            InsertMethod="AddShipmentItem" OldValuesParameterFormatString="{0}"
            SelectMethod="getAllShipmentItemsByReferenceNumber" TypeName="GTSSystem.BLL.ShipmentItems" UpdateMethod="UpdateShipmentItem">
            <DeleteParameters>
                <asp:Parameter Name="ShipmentItemId" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ShipmentitemId" Type="Int32" />
                <asp:Parameter Name="ReferenceNumber" Type="Int32" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="Weight" Type="Double" />
                <asp:Parameter Name="Length" Type="Double" />
                <asp:Parameter Name="Height" Type="Double" />
                <asp:Parameter Name="Width" Type="Double" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ReferenceNumber" Type="Int32" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="Weight" Type="Double" />
                <asp:Parameter Name="Length" Type="Double" />
                <asp:Parameter Name="Height" Type="Double" />
                <asp:Parameter Name="Width" Type="Double" />
            </InsertParameters>
            <SelectParameters>
                <asp:QueryStringParameter Name="ReferenceNumber" QueryStringField="ReferenceNumber"
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="ShipmentSource" runat="server" InsertMethod="CreateShipment"
            OldValuesParameterFormatString="{0}" SelectMethod="getShipmentByReferencenumber"
            TypeName="GTSSystem.BLL.Shipment" UpdateMethod="UpdateShipment">
            <UpdateParameters>
                <asp:Parameter Name="ReferenceNumber" Type="Int32" />
                <asp:Parameter Name="Shipmentdate" Type="DateTime" />
                <asp:Parameter Name="ClientId" Type="Int32" />
                <asp:Parameter Name="ClientBranchid" Type="Int32" />
                <asp:Parameter Name="CarrierId" Type="Int32" />
                <asp:Parameter Name="Weight" Type="Double" />
                <asp:Parameter Name="Origin" Type="Int32" />
                <asp:Parameter Name="OriginAddress" Type="String" />
                <asp:Parameter Name="OriginPostalCode" Type="String" />
                <asp:Parameter Name="Destination" Type="Int32" />
                <asp:Parameter Name="DestinationAddress" Type="String" />
                <asp:Parameter Name="DestinationPostalCode" Type="String" />
                <asp:Parameter Name="ServicetTypeId" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="GST" Type="Double" />
                <asp:Parameter Name="PST" Type="Double" />
                <asp:Parameter Name="HST" Type="Double" />
                <asp:Parameter Name="Surcharge" Type="Double" />
                <asp:Parameter Name="TotalPieces" Type="Int32" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="StatusId" Type="Int32" />
                <asp:Parameter Name="ShipmentNumber" Type="Int32" />
            </UpdateParameters>
            <SelectParameters>
                <asp:QueryStringParameter Name="ReferenceNumber" QueryStringField="ReferenceNumber"
                    Type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="Shipmentdate" Type="DateTime" />
                <asp:Parameter Name="ClientId" Type="Int32" />
                <asp:Parameter Name="ClientBranchid" Type="Int32" />
                <asp:Parameter Name="CarrierId" Type="Int32" />
                <asp:Parameter Name="Weight" Type="Double" />
                <asp:Parameter Name="Origin" Type="Int32" />
                <asp:Parameter Name="OriginAddress" Type="String" />
                <asp:Parameter Name="OriginPostalCode" Type="String" />
                <asp:Parameter Name="Destination" Type="Int32" />
                <asp:Parameter Name="DestinationAddress" Type="String" />
                <asp:Parameter Name="DestinationPostalCode" Type="String" />
                <asp:Parameter Name="ServicetTypeId" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="GST" Type="Double" />
                <asp:Parameter Name="PST" Type="Double" />
                <asp:Parameter Name="HST" Type="Double" />
                <asp:Parameter Name="Surcharge" Type="Double" />
                <asp:Parameter Name="TotalPieces" Type="Int32" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="StatusId" Type="Int32" />
                <asp:Parameter Name="ShipmentNumber" Type="Int32" />
            </InsertParameters>
        </asp:ObjectDataSource>
    </p>
</asp:Content>

